package net.gui;

import java.awt.BorderLayout;
import java.awt.Image;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class Window extends JFrame
{
	private static final long serialVersionUID = -2817650549532373141L;

	private static Image icon;
	
	private final JPanel screen;
	
	private final MenuBar menubar;
	
	private final PDFInfoPane infoPane;
	
	private final VisualDatabasePane databasePane;
	
	private final DatabaseFilterPane filterPane;
	
	private final SearchBar searchBar;
	
	private final HiddenTabs tabs;
	
	public Window()
	{
		setEnabled(true);
		setVisible(true);
		setTitle("PDF Database Manager");
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setBounds(200, 200, 400, 400);
		setLayout(new BorderLayout(0, 10));
		setIconImage(icon);
		
		screen = new JPanel();
		screen.setLayout(new BorderLayout(2, 2));		
		add(screen, BorderLayout.CENTER);
		
		menubar = new MenuBar();
		setJMenuBar(menubar);
		
		infoPane = new PDFInfoPane();
		screen.add(infoPane, BorderLayout.WEST);
		
		searchBar = new SearchBar();
		
		screen.add(searchBar, BorderLayout.NORTH);
		
		databasePane = new VisualDatabasePane();
		screen.add(databasePane, BorderLayout.CENTER);
		
		filterPane = new DatabaseFilterPane();
		screen.add(filterPane, BorderLayout.EAST);
		
		tabs = new HiddenTabs();
		screen.add(tabs, BorderLayout.SOUTH);
		
		repaint();
	}

	static
	{
		try
		{
			icon = ImageIO.read(new File("src/resources/PDFWindowIcon.png"));
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
	}
}
